home *** CD-ROM | disk | FTP | other *** search
- (*---------------------------------------------------------------------------*)
- (* Format_Line -- Format text for screen display *)
- (*---------------------------------------------------------------------------*)
-
- PROCEDURE Format_Line( Txt: AnyStr; ScrLin : INTEGER );
-
- (*---------------------------------------------------------------------------*)
- (* *)
- (* Routine: Format_Line *)
- (* *)
- (* Purpose: Format text for screen display *)
- (* *)
- (* Calling Sequence: *)
- (* *)
- (* Format_Line( Txt: AnyStr; ScrLin: INTEGER ); *)
- (* *)
- (* Txt --- The text to be displayed *)
- (* ScrLin --- Screen row of 'Txt' *)
- (* *)
- (* Calls: TextColor *)
- (* *)
- (* Called By: Display_Screen *)
- (* *)
- (* Remarks: *)
- (* *)
- (* Up to a maximum of 'width' characters will be displayed *)
- (* starting at 'first_col'. Column one is always displayed *)
- (* if line-printer controls are requested. Unprintable *)
- (* characters are printed as their ASCII mnemonics enclosed *)
- (* in angular brackets. *)
- (* *)
- (*---------------------------------------------------------------------------*)
-
- VAR
- i: INTEGER;
- j: INTEGER;
- n: INTEGER;
- len: INTEGER;
- c: CHAR;
- name: CHAR6;
- Ipos: INTEGER;
- LColor: CHAR;
-
- BEGIN (* Format_Line *)
-
- len := LENGTH( Txt );
-
- Ipos := ( ScrLin - 1 ) * 160 + 1;
-
- (* If this line is string-search *)
- (* result, high-light it. *)
- IF ScrLin = Search_Lpos THEN
- BEGIN
- LColor := CHR( Search_Text_Color );
- Search_Lpos := 0;
- END
- ELSE
- LColor := CHR( ForeGround_Color );
-
- IF lpt THEN
- BEGIN
- My_Screen[ Ipos + 1 ] := LColor;
- My_Screen[ Ipos ] := Txt[1];
- Ipos := Ipos + 2;
- n := 1;
- END
- ELSE
- n := 0;
-
- i := first_col;
- (* Insert each character into screen *)
- (* image. Strip high bit if requested. *)
-
- WHILE (i <= len) AND (n < width) DO
- BEGIN
-
- c := Txt[i];
-
- i := i + 1;
-
- IF c IN spec_chars THEN
- BEGIN
-
- IF ord(c) = 127 THEN
- name := '<DEL> '
- ELSE
- name := spec_names[c];
-
- j := 1;
-
- WHILE (Name[j] <> ' ') AND (n < width) DO
- BEGIN
- My_Screen[ Ipos + 1 ] := LColor;
- My_Screen[ Ipos ] := Name[j];
- Ipos := Ipos + 2;
- j := j + 1;
- n := n + 1;
- END
- END
- ELSE
- BEGIN
- My_Screen[ Ipos + 1 ] := LColor;
- My_Screen[ Ipos ] := c;
- Ipos := Ipos + 2;
- n := n + 1;
- END;
-
- END;
-
- For I := ( n + 1 ) To 80 Do
- BEGIN
- My_Screen[ Ipos + 1 ] := CHR( BackGround_Color );
- My_Screen[ Ipos ] := ' ';
- Ipos := Ipos + 2;
- END;
-
- END (* Format_Line *);